import { Controller, Get, Query } from '@nestjs/common';
import { WeatherService } from './weather.service';
import { BaseResult } from '../entity/dto/base.dto';

@Controller('weather')
export class WeatherController {
  constructor(private readonly weatherService: WeatherService) {}

  @Get('cityKey')
  queryCityName(@Query('cityName') cityName: string) {
    return BaseResult.success(this.weatherService.queryCityName(cityName));
  }

  @Get('query')
  query(@Query('cityKey') cityKey: string) {
    return BaseResult.success(this.weatherService.query(cityKey));
  }
}
